Skip to content

Compile treesitter parsers with MinGW gcc on Windows - #21

Merged
SimonKimDev merged 1 commit into
mainfrom
simonk/dev/treesitter-gcc-windows
Oct 24, 2026
Merged

SimonKimDev merged 1 commit into
mainfrom
simonk/dev/treesitter-gcc-windows

Conversation

@SimonKimDev

Copy link
Copy Markdown
Owner

On Windows the tree-sitter CLI that nvim-treesitter uses to compile parsers looks for MSVC and ignores a MinGW gcc on PATH. So with the README's setup (gcc from MinGW, no Visual Studio), every parser failed with "Failed to execute the C compiler … program not found". CI didn't catch it because the windows-latest runner has MSVC.

Change

  • lazy/treesitter.lua: on Windows, when CC isn't set and cl isn't on PATH but gcc is, set vim.env.CC = "gcc" before installing parsers. It only affects Neovim's child processes, and MSVC setups (a VS developer shell, or an explicit CC) are left alone.
  • README: mention it in the C compiler requirement.

Testing

On a fresh Windows setup (Neovim 0.12.6, WinLibs gcc 16.2 and make from winget, no MSVC):

  • Before: all 21 parsers that Neovim doesn't bundle failed to compile.
  • After: with no CC in the environment, the config sets CC=gcc. Force-reinstalling toml downloads, compiles and loads it.
  • stylua --check . with StyLua 2.3.0 on an LF copy: clean.
  • The smoke test passes on that machine (smoke: OK).

On Windows the tree-sitter CLI looks for MSVC and doesn't try a gcc on PATH,
so with the README's MinGW setup every parser failed with "Failed to execute
the C compiler ... program not found". CI didn't notice because its runner has
MSVC. Point it at gcc (CC=gcc) when there's no cl on PATH and CC isn't set.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SimonKimDev
SimonKimDev merged commit 70921ba into main Oct 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant